This script gives you the ability to process an entire folder of text files at once with TQMGhost. You do not need the full version of Frontier to run it. Frontier Runtime works just fine. Frontier Runtime is included free with select software packages such as QuarkXPress, and is also available as shareware on the finer on-line services. It is dialog driven instead of drag & drop, thus it is better suited to large batches of files to process.
In a nutshell:
1. You launch the script.
2. Select the folder containing the set file or files you wish to apply to the text. (You may optionally select individual set files independent of folders).
3. Select the folder with the text to process.
4. TQMGhost does its thing.
5. The finished files are placed in a folder inside the text folder.
6. Bonus: The files are automatically changed from TQM files into text files for the word processor of your choice.
TQM Batch Process — The details:
This takes longer to describe than to do it...
1. Launch the script.
Launch the script by either double-clicking on the script icon or locating it with the “Run Script” menu item under the File menu in Frontier Runtime™. You can also put the script file (or an alias of it) in your Apple Menu Items folder and launch it from the Finder’s Apple Menu.
You will get an introductory dialog with three buttons. “Cancel” is obvious...this ends the script. “Prefs” gets you into a dialog that lets you customize how TQM Batch Process works, as well as give you access to some file conversion utilities. We’ll deal with those later. The main button is “Start,” and that’s what we’ll try first.
2. Select the set files.
As shipped, TQM Batch Process first asks you if you want to select set files by folder or by single files. Click the “Folder” button and TQM Batch Process will let you select a folder containing set files. With the desired folder highlighted in the selection window, click on the BOTTOM button containing the folder name (NOT the “Open” button...this opens the folder in the selection window). The set files in the selected folder will be applied to all text files in alphabetical order.
Don’t want to select a whole folder of set files? If you click the “Single” button, TQM Batch Process will present you a series of file dialogs (up to 32 . . .the maximum number of set files allowed in a Torque session). Within each dialog, find and select a single set file. Hit the “Open” button. Another dialog will appear to let you select the next file. Notice the dialogs keep track of the number of files you are selecting at the bottom. When you have selected all the set files you desire, click the “Cancel” button in the next dialog.
NOTE: Keep in mind if you select the set files individually, they will be run IN THE ORDER SELECTED, not in alphabetical order. This can have a profound effect on how the translations work. See the TQMGhost documentation concerning the implications of set order.
3. Select the text folder.
Once the set files (or folder) have been selected, a dialog will appear asking for the folder containing the text. Locate and highlight the desired folder in the search window, then click the button at the bottom containing the folder’s name.
4. Torquemada’s Ghost takes it from there.
5. See the finished product.
As shipped, the script finishes by creating a folder in the text folder called “Torqued Text,” the text folder opens so you can see the results, and an audible signal and dialog tell you the work is done.
6. Bonus!
The files inside the “Torqued Text” folder are Microsoft Word text files. You can open them in any word processor or text editor (they are TEXT files, not word processor files), they have just been altered to automatically launch MS Word when double-clicked.
Customizing TQM Batch Process:
What? You want the files saved as WordPerfect text files instead of MS Word? You don’t want the folder to open at the end and beep at you? You intend to always select sets by folders and think the extra dialog asking how you want to select sets is a pain?
No problem. When the introductory dialog comes up, click the “Prefs” button. Now you’re looking at a dialog that lets you set preferences for TQM Batch Process.
Starting at the upper left, you can set Translation Set Selection to always ask for a folder, always ask for individual files, or always display the dialog that asks you which you want.
To the right of those buttons are two check boxes. The first turns the Alerts and Messages on and off. When checked, it will beep at you and display a dialog when the script is finished, as well as display progress messages in the Frontier main window. Turn Alerts and Messages off and TQM Batch Process will quit silently. The second check box controls the option to have the text folder open automatically at the end of the process. Checked, the text folder will always open at the end. Unchecked, the folder will remain as it is.
In the middle of the dialog is a group of buttons that let you select which word processor you want to use. Buttons are provided for MS Word, the world’s most widely used Mac wp, and MacWrite Pro, another popular product.
The third button is set to TeachText as a default, but you can change this button to any word processor installed on your Macintosh. Click the “Choose” button. You will see a file dialog. Select any file* that was created with the word processor you desire...or you can select the word processor application file itself, if you wish. Click the “Open” button and the script will extract information from the file. When you return to the Preferences dialog, the name of your selected word processor will appear next to the third button. Choosing this button will make TQM Batch Processor automatically convert finished text files so they launch the chosen word processor when double clicked (they will still be ASCII text files, though).
*Note that if you select a file created by something OTHER than a word processor, TQM Batch Processor cannot catch the error. Choose files carefully.
Also note it is possible to have a file on your hard drive created by an application you do not have installed, say a file copied from another computer. If you choose such a file, TQM Batch Processor will not be able to get the app’s name, but it will still be able to make files for this application. In such cases, the label next to the third button will read “Unknown (creator: ‘????”)” with the question marks replaced by the app’s “creator” code.
Just below the word processor buttons is a text field named Destination Folder Name. If you don’t like the name “Torqued Text,” you can choose any name you like and type it here. All future destination folders created inside the text folders will use this name.
Now look at the buttons across the bottom. “Done” dismisses the dialog and returns you to the introductory dialog. “Info” displays information about this script, then returns you to the preferences dialog.
The two buttons on the bottom left give you access to a couple of handy utilities:
Assuming you will be writing your own set files, you will probably want to use your favorite word processor (especially since Torquemada’s Ghost doesn’t come with a set file editor). Create your sets in a word processor following TQM specifications. Save them from your word processor as a TEXT file. Now you need to convert that TEXT file into an official TQM set file.
Launch TQM Batch Processor, get into the “Prefs” dialog and click on the “TQM Set” button. A file dialog will appear. Find and open the file you wish to convert to a TQM set file. Bingo, it’s done.
OK, so now you want to make some changes to that TQM set file in a word processor. By clicking the “WP Text” button, you will get a file dialog again. Find and open the file and the type and creator will be changed into a TEXT file that launches the selected word processor.
NOTE: To avoid errors, the TQM Set button only lets you select TEXT files; the WP Text button will only let you see TQM set files and TEXT files. (In other words, if you don’t see your newly-edited set file in the dialog, you probably didn’t save it as a TEXT file like you should).
Finally:
Greg Swann is a cool programmer, but he’s kinda new to scripting. <g>
So any questions, comments, or suggestions on how to improve and enhance this script should be directed to Eugene Barnes, CompuServe: 75250,1347.
Please see the main read-me file for additional information about this script.